package com.example.androidhive;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;


import android.graphics.BitmapFactory;

public class Connecetion1 {

    public void setNetwork()
    {
       try
       {

           URL url = new URL("http://opiekuj1.javaprovider.net/kodsms/3.jpg");

           URLConnection connection=url.openConnection();
           
           HttpURLConnection HCon=(HttpURLConnection)connection;
            
           int ResCode=HCon.getResponseCode();

           System.out.println("Responce Code is = "+ResCode);
            
            
           if(ResCode==HttpURLConnection.HTTP_OK)
           {
                
           InputStream ins=((URLConnection)HCon).getInputStream();    
                
                 Data.StoreImg=BitmapFactory.decodeStream(ins);
            
            
           }
  
       }
       catch (MalformedURLException e) 
           {
            
           e.printStackTrace();
       } catch (IOException e) 
           {
        
             e.printStackTrace();
            }
        
    }

}
